package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC997 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int findJudge(int n, int[][] trust) {
            int[] inDegrees = new int[n + 1];
            int[] outDegrees = new int[n + 1];
            for (int[] edge : trust) {
                int x = edge[0], y = edge[1];
                ++inDegrees[y];
                ++outDegrees[x];
            }
            for (int i = 1; i <= n; ++i) {
                if (inDegrees[i] == n - 1 && outDegrees[i] == 0) {
                    return i;
                }
            }
            return -1;
        }
    }


    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC997 an = new LC997();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
